#include <stdio.h>
void menu()
{
    printf("****************************\n");
    printf("******1. add  2. sub *******\n");
    printf("******3. mul  4. div *******\n");
    printf("******0. exit  *************\n");
}

int Add(int x, int y)
{
    return x + y;
}
int Sub(int x, int y)
{
    return x - y;
}
int Mul(int x, int y)
{
    return x * y;
}
int Div(int x, int y)
{
    return x / y;
}
int main()
{
    int x, y;
    int input;
    do
    {
        menu();
        printf("chose\n");
        scanf("%d", &input);
        int res;
        switch (input)
        {
        case 1:
            printf("please input two nums\n");
            scanf("%d %d", &x, &y);
            res = Add(x, y);
            printf("%d\n", res);
            break;
        case 2:
            printf("please input two nums\n");
            scanf("%d %d", &x, &y);
            res = Sub(x, y);
            printf("%d\n", res);
            break;
        case 3:
            printf("please input two nums\n");
            scanf("%d %d", &x, &y);
            res = Mul(x, y);
            printf("%d\n", res);
            break;
        case 4:
            printf("please input two nums\n");
            scanf("%d %d", &x, &y);
            res = Div(x, y);
            printf("%d\n", res);
            break;
        case 0:
            printf("exit \n");
            break;
        default:
            printf("error \n");
            break;
        }

    } while (input);
    // case 1 2 3 4 仅有函数调用不同
    // 可以进行适当的封装

    return 0;
}